package com.mc.servlet;

import com.mc.bean.Jury;
import com.mc.service.JuryService;
import com.mc.service.impl.JuryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author fyp
 * 评委列表控制器
 */
@WebServlet("/jurylist.action")
public class JuryListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建评委逻辑对象
        JuryService juryService=new JuryServiceImpl();
        List<Jury> list=juryService.findAll();
        //放入作用域
        req.setAttribute("list",list);
        //转发
        req.getRequestDispatcher("jurylist.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
